<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
 
<html>
  <head>
    <link href="<s:url value="/resources"/>/css/style_new.css" rel="stylesheet" type="text/css" />
    <link href="<s:url value="/resources"/>/css/main_new.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/cupertino/jquery-ui.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/ui.multiselect.css" />
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script>  
    <script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/grid.locale-cn.js"></script> 
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
    <style>
html, body {
	margin: 0;			 
	padding: 0;
    font-size: 85%;
}
</style>
    
  </head>
  
  <script type="text/javascript">  
  var qieye = 0;

    $(function(){        
   
    loadTab(0);
    $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]);
    $( "#datepicker1" ).datepicker($.datepicker.regional[ "zh-CN" ]);  

    
 });
 
 function loadTab(i){  
    $("#myTab0").jqGrid({      
    url:'findDsdd', 
    datatype: 'json',
    mtype: 'post',         
   	colNames:['操作','报单单位','应单单位', '价格类型','价格', '数量','煤种','品种','签订日期','toid'],
   	colModel:[ 
   	    {name:'Verify',index:'toid',width:120,align:"center",sortable:false},
   	    {name:'bddwmc',index:'bddwmc', width:200},	  		
   		{name:'yddwmc',index:'yddwmc', width:200},
   		{name:'pricename',index:'pricename', width:70},
   		{name:'toprice',index:'toprice', width:70},
   		{name:'toquality',index:'toquality', width:70 },
   		{name:'meiz',index:'meiz', width:70 },
   		{name:'pinz',index:'pinz', width:70 },
   		{name:'totime',index:'totime', width:120},	
   		{name:'toid',index:'toid'}		
   	],
   
    jsonReader: {
           repeatitems : false, 
           id: 'toid'
         },
    width: 1380, 
    shrinkToFit:true,    	
   	rowNum:10,
   	rowList:[10,20,30],     	
   	pager: '#pager'+i,   	
   	rownumbers: true,   	 
    viewrecords: true,
    multiselect: false,
    sortorder: 'desc',  
    //altRows:true,  
	caption: "日常报单",
	gridComplete:function()
	{ //在此事件中循环为每一行添加修改和删除链接 
		var ids=jQuery("#myTab0").jqGrid('getDataIDs'); 		
		for(var j=0; j<ids.length; j++)
		{ 
			var id=ids[j]; 		
			//var jsv = $("#myTab"+i).jqGrid('getRowData',ids[j]);
			  //if(jsv.zhuangt==1){
				  verify ="<a href='#' style='color:#f60' onclick=\"openwindow('findAddDsddRcbdView',"+ id +")\">签订电子合同</a>";
			  //}
			
			jQuery("#myTab0").jqGrid('setRowData',ids[j], { Verify: verify }); 
		} 
	} 	
  });
  $("#myTab"+i).jqGrid('setGridHeight','280px');
 // $("#myTab"+i).jqGrid('hideCol',["toid"]);
  }


//查询
 function search(){ 

  var formdata = $("#form1").serialize();  
  $("#myTab0").jqGrid('setGridParam',{url:'findDsdd?'+formdata+'&index='+qieye,mtype:'post',page:1}).trigger("reloadGrid"); 
 }
//重置
 function resetSearch(){
 	$('#list_search  input[type=text]').val('');
 	$('#list_search select').val('-1');
 }

 function openwindow(url,id){
	   var toid=id;
	   url=url+"?toid="+id;
	   //alert(toid);
	    var sheight = screen.height-70;
	    var swidth = screen.width-10;
	   var winoption ="dialogHeight:"+sheight+"px;dialogWidth:"+ swidth +"px;status:yes;scroll:yes;resizable:yes;center:yes";
	    var result=window.showModalDialog(url,window,winoption);
	    //alert(result);
	    if(result ==1){
	     reloadhtxx();
	      }
	    return result;  
	}
 
 function reloadhtxx(){
	   window.location.href="findRcbdView";
	}
</script>  
<body> 
<div class="container">  
<div class="containerbox">
<div class="btn-bar"> 
<p><img src="<s:url value="/resources"/>/img/htlc.gif" width="1200" height="40"></p>
</div>
<div class="search mt10" id="list_search">
<form id="form1" method="post">

<table class="search-table" width="90%" cellpadding="0" cellspacing="0" border="0"> 
        <tr>
        	<td> 
            	订单编号: 
            </td>
            <td>
            	<input type="text" name="aa" class="form-textbox" style="width: 200px;"/> 
            </td>
            <td>
                煤种:
            </td>
            <td>
            	<div class="pr10 search-table-70"><div>
            	<select name="bb" class="form-textbox" style="width: 200px;">
            	<option value="-1" selected>==请选择==</option>
                   <c:forEach var="mz" items="${meiz}">
                   <option value="${mz.diccode}">
                   ${mz.dicname}
                   </option>
                   </c:forEach>
                 </select>
            	</div></div> 
            </td>            
            <td>
               品种 :
            </td>
            <td>
            	<div class="pr10 search-table-70"><div>
            	<select name="cc" class="form-textbox" style="width: 200px;">
            	<option value="-1" selected>==请选择==</option>
                   <c:forEach var="pz" items="${pinz}">
                   <option value="${pz.diccode}">
                   ${pz.dicname}
                   </option>
                   </c:forEach>
                 </select>
            	
            	</div></div>
            </td>
        </tr>
        <tr>
        <td>出卖人:</td>
        <td><input type="text" name="dd" class="form-textbox" style="width: 200px;"/></td>
         <td>买受人:</td>
        <td><input type="text"  name="ee" class="form-textbox" style="width: 200px;"/></td>
        <td>价格类型:</td>
        <td><input type="text" name="ff" class="form-textbox" style="width: 200px;"/></td>
        </tr>
        
        <tr>
        <td>价格:</td>
        <td><input type="text" name="gg" class="form-textbox" style="width: 93px;" onKeyUp="this.value=this.value.replace(/\D/g,'');" />
          --
          <input type="text" name="hh" class="form-textbox" style="width: 93px;" onKeyUp="this.value=this.value.replace(/\D/g,'');" /></td>
        <td>数量:</td>
        <td><input type="text" name="ii" class="form-textbox" style="width: 93px;" onKeyUp="this.value=this.value.replace(/\D/g,'');" />
          --
          <input type="text" name="jj" class="form-textbox" style="width: 93px;" onKeyUp="this.value=this.value.replace(/\D/g,'');" /></td>
        <td>签订日期:</td>
            <td>
            	<input id="datepicker" type="text" name="kk" class="form-textbox" style="width: 93px;"/> -- <input id="datepicker1" type="text" name="ll" class="form-textbox" style="width: 93px;"/>
            </td>
        </tr>

		<tr>
    <td align="left" valign="middle" colspan="6">
<table border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td align="right" class="pr10 search-table-70">&nbsp;</td>
    <td align="left"><input name="" type="button" class="form-button-query form-button" value="查询" onclick="search();"/>
    <input name="" type="button" class="form-button-reset form-button" value="重置"  onclick="resetSearch();"/></td>
  </tr>
</table></td>
  </tr>
  </table> 
  </form> 
  </div>  
       
   <div id="tabs">
			<ul>
				<li><a href="#tabs-0">电子订单</a></li>
			</ul>
			<div id="tabs-0">
				<table id="myTab0" class="scroll" cellpadding="0" cellspacing="0"></table>
				<div id="pager0" class="scroll"></div>
				<div id="message0" class="scroll"></div>
			</div>
	

   </div>
</div> 
</div>
</body>
</html>
